package com.cms.admin.service.common.impl;

import com.cms.admin.mapper.GoodsPriceListMapper;
import com.cms.admin.model.GoodsPriceList;
import com.cms.admin.model.GoodsPriceListExt;
import com.cms.admin.model.PageBean;
import com.cms.admin.service.common.GoodsPriceListService;

import java.util.List;

/**
 * Created by YYY-Work on 2017/5/3.
 */
public class GoodsPriceListServiceImpl implements GoodsPriceListService{

    private GoodsPriceListMapper goodsPriceListMapper;

    @Override
    public GoodsPriceList queryStuffGoodsPriceListByPriceId(GoodsPriceList example) {
        return goodsPriceListMapper.selectByPriceId(example);
    }

    @Override
    public List<GoodsPriceListExt> queryGoodsPriceList(PageBean page, GoodsPriceListExt example) {
        int count=getRowCount(example);
        page.setAllRow(count);
        example.setOffset(page.getOffset());
        example.setPageSize(page.getPageSize());
        return goodsPriceListMapper.selectByConditionWithLimit(example);
    }

    @Override
    public int getRowCount(GoodsPriceListExt example) {
        return goodsPriceListMapper.countByCondition(example);
    }

    @Override
    public int addGoodsPriceList(GoodsPriceListExt record) {
        return goodsPriceListMapper.insertSelective(record);
    }

    @Override
    public  List<GoodsPriceListExt> checkGoodsPriceListExit(GoodsPriceListExt example) {
        return goodsPriceListMapper.checkGoodsPriceListExit(example);
    }

    @Override
    public int updateGoodsPriceList(GoodsPriceListExt record) {
        return goodsPriceListMapper.updateByPrimaryKeySelective(record);
    }


    public GoodsPriceListMapper getGoodsPriceListMapper() {
        return goodsPriceListMapper;
    }

    public void setGoodsPriceListMapper(GoodsPriceListMapper goodsPriceListMapper) {
        this.goodsPriceListMapper = goodsPriceListMapper;
    }
}
